#include "udp_server.hpp"
using namespace::std;
using namespace::Udp_Server;

//上层的业务处理，不关心网络发送，只负责信息处理即可
std::string transactionString(std::string request)
{
    std::string result;
    char c;

    for(auto &r : request)
    {
        if(islower(r)) 
        {
            c = toupper(r);
            result.push_back(c);
        }
        else
        {
            result.push_back(r);
        }
    }

    return result;
}

// std::string excuteCommand(std::string command)
int main(int argc,char* argv[])
{
    if(argc < 2)
    {
        cerr << "请输入port" << endl;
        exit(USEAGE_ERR);
    }
    uint16_t port = atoi(argv[1]);
    unique_ptr<UdpServer> usvr(new UdpServer(transactionString,port));

    usvr->init_server();
    usvr->start();
    return 0;
}